package com.feri.fss.common.vo;

/**
 * @author Feri
 * @date 2021/12/13 15:24
 * @description:TODO
 */
public class R {
    private int code;//状态码
    private String msg;//状态码的中文解释
    private Object data;

    public R() {
    }

    public R(int code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


    //封装一些快速的方法
    public static R ok(String msg,Object data){
        return new R(200,msg,data);
    }
    public static R ok(){
        return ok("OK",null);
    }
    public static R ok(Object data){
        return ok("OK",data);
    }
    public static R fail(String msg,Object data){
        return new R(400,msg,data);
    }
    public static R fail(){
        return fail("FAIL",null);
    }
    public static R fail(String msg){
        return fail(msg,null);
    }
}
